import java.util.Arrays;
import java.util.Scanner;

class Money implements Cloneable{//你要进行拷贝，就要实现Cloneable
    public double m = 200.0;

    @Override
    protected Object clone() throws CloneNotSupportedException {
                                   //要对clone()接口进行重写
        return super.clone();
    }
}
class Person implements Cloneable{
    public String name="张三";
    public Money money = new Money();

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Person tmp = (Person) super.clone();
        tmp.money = (Money) this.money.clone();
        return tmp;
    }

    @Override
    public String toString() {
        return "Person{" +
                '}';
    }
}
public class Main {
    public static void main(String[] args) throws
            CloneNotSupportedException{
        Person person = new Person();

        Person person2 = (Person)person.clone();
        person2.money.m = 1999;

        System.out.println(person.name+" "+person.money.m);

        System.out.println(person2.name+" "+person2.money.m);
    }


    public static void main2(String[] args) {
        int [] arr=new int []{1,2,3,4};
        System.out.println(arr.hashCode());//打印arr的具体位置
        //hashCode算一个具体的对象位置
        int [] arr1=arr.clone();
        System.out.println(arr1.hashCode());
        arr1[0]=99;
        System.out.println(Arrays.toString(arr));
        System.out.println(Arrays.toString(arr1));
    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String str = scanner.nextLine();
            char[] ret = str.toCharArray();
            for (int i = 0; i < ret.length; i++) {
                for (int j = i + 1; j < ret.length; j++) {
                    if (ret[i] == ret[j]) {
                        ret[j] = 0;
                    }
                }
                    if (ret[i] != 0) {
                        System.out.print(ret[i]);
                    }
            }
            System.out.println();
        }
    }
}